package org.madgecko.api.controller;

import org.madgecko.api.model.AjaxXmlReturn;
import org.madgecko.api.model.Person;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Author       : MadFrog
 * Date         : 2018/12/14 21:56
 * Description  : xml格式数据返回测试
 * xml数据格式返回使用说明
 * 在同时引入jakson json和xml解析的情况下，springMVC默认情况会自动优先将返回格式转为xml
 */
@Controller
public class XmlController {

    @ResponseBody
    @RequestMapping(value = "/xml", produces={"application/xml; charset=UTF-8"})
    public AjaxXmlReturn xml() {
        Person person = new Person();
        person.setAge(25);
        person.setName("你大爷");
        return new AjaxXmlReturn(true, person);
    }

}
